package com.bxj.wxtt.api.constant;

/**
 * Created by baixiujiang on 17/10/19.
 */
public enum PlatformBitEnum {
    PLATFORM_BIT_ANDROID(1, "安卓"),
    PLATFORM_BIT_IOS(1 << 1, "ios"),
    PLATFORM_BIT_WAP(1 << 2, "wap"),
    PLATFORM_BIT_WEB(1 << 3, "网站"),
    PLATFORM_BIT_IPAD(1 << 4, "ipad"),
    PLATFORM_BIT_APAD(1 << 5, "apad"),
    PLATFORM_BIT_JAVA(1 << 6, "java");

    Integer value;
    String desc;

    PlatformBitEnum(Integer value, String desc) {
        this.value = value;
        this.desc = desc;
    }

    public String getDesc() {
        return desc;
    }

    public void setDesc(String desc) {
        this.desc = desc;
    }

    public Integer getValue() {
        return value;
    }

    public void setValue(Integer value) {
        this.value = value;
    }

    public static Integer isPlatform(Integer bits, PlatformBitEnum platformBitEnum) {
        return (platformBitEnum.getValue() & bits) == platformBitEnum.getValue() ? 1 : 0;
    }
}
